import cloneDeep from 'lodash/cloneDeep'

import * as enumSrc from '@/utils/enum'

const formatTime = (time, reg = 'YYYY-MM-DD') => {
    return time ? dayjs(time).format(reg) : ''
}

const getEnum = (enumName, key) => enumName ? (enumSrc?.[enumName]?.[key] || '') : ''
const lodash = {
    formatTime,
    getEnum,
    cloneDeep,
}

export default {
    install (Vue) {
        Vue.prototype._ = lodash
    }
}
